package com.bitdf.txing.group.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bitdf.txing.common.utils.PageUtils;
import com.bitdf.txing.group.dao.GroupImgDao;
import com.bitdf.txing.group.entity.GroupImgEntity;
import com.bitdf.txing.group.service.GroupImgService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


@Service("groupImgService")
public class GroupImgServiceImpl extends ServiceImpl<GroupImgDao, GroupImgEntity> implements GroupImgService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
//        IPage<GroupImgEntity> page = this.page(
//                new Query<GroupImgEntity>().getPage(params),
//                new QueryWrapper<GroupImgEntity>()
//        );

//        return new PageUtils(page);
        return null;
    }

    /**
     * 添加组团图片
     *
     * @param imgList
     * @param id
     * @return
     */
    @Override
    public boolean saveGroupImgs(List<String> imgList,String surfaceImg, Long id) {
        List<GroupImgEntity> list=new ArrayList<>();
        for (String s : imgList) {
            GroupImgEntity entity = new GroupImgEntity();
            entity.setImgUrl(s);
            entity.setGroupId(id);
            entity.setStatus(0);
            list.add(entity);
        }
        GroupImgEntity entity = new GroupImgEntity();
        entity.setGroupId(id);
        entity.setImgUrl(surfaceImg);
        entity.setStatus(1);
        list.add(entity);

        return this.saveBatch(list);
    }

}